package com.eims.sls_app.ui;

import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.eims.sls_app.dataaccess.Users;
import com.eims.sls_app.dataaccess.utils.HttpUtils;
import com.eims.sls_app.protocol.MD5;
import com.eims.sls_app.protocol.RspBodyBaseBean;
import com.eims.sls_app.utils.App;
import com.eims.sls_app.utils.BaseHelper;
import com.eims.sls_app.utils.LotteryUtils;
import com.eims.sls_app.utils.MyPushTask;
import com.eims.sls_app.utils.NetWork;
import com.eims.sls_app.utils.VerificationCodeUtils;
import com.eims.sls_app.view.MyToast;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

import bls.juejin.cn.R;

public class Regist_phoneNum_new_Activity extends MyBaseActivity implements
		View.OnClickListener {
	private Context context = Regist_phoneNum_new_Activity.this;
	private Button btn_login, btn_reg, check_phone_ma_button_phone;
	private ImageButton btn_back;
	private EditText et_name, et_name_phone, et_pass, et_upass, check_phone_ma_edit_phone,et_qq;
	private String userName, userNamePhone, userPass, userRePass, userQQ;
	private String opt, auth, info, time, imei, crc; // 格式化后的参数
	private MyHandler myHandler;
	private ProgressDialog mProgress = null;
	private TextView reg_tip, reg_phone_num_text_username, tv_passAlert;
	private VerificationCodeUtils verificationCodeUtils;
	private long lastRegistTime = 0;

	private LinearLayout tv_passSecurityLevel;// 密码安全度判断显示
	private TextView tv_weaK, tv_middle, tv_strong;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 设置无标题
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_regist_phone_num);
		App.activityS.add(this);
		init();
		findView();
		setListener();
	}

	/**
	 * 初始化UI
	 */
	private void findView() {
		myHandler = new MyHandler();
		tv_passSecurityLevel = (LinearLayout) this
				.findViewById(R.id.tv_passSecurityLevel);// 密码安全度显示
		tv_weaK = (TextView) findViewById(R.id.tv_weak);
		tv_middle = (TextView) findViewById(R.id.tv_middle);
		tv_strong = (TextView) findViewById(R.id.tv_strong);
		tv_passSecurityLevel.setVisibility(View.GONE);

		tv_passAlert = (TextView) findViewById(R.id.tv_passAlert);
		tv_passAlert.setVisibility(View.GONE);

		btn_back = (ImageButton) this.findViewById(R.id.btn_back);
		btn_login = (Button) this.findViewById(R.id.reg_top_btn_login_phone);
		btn_reg = (Button) this.findViewById(R.id.reg_btn_reg_phone);

		et_name = (EditText) this.findViewById(R.id.reg_et_userName);
		et_name_phone = (EditText) this.findViewById(R.id.reg_et_userName_phone);
		et_pass = (EditText) this.findViewById(R.id.reg_et_userPass_phone);
		et_upass = (EditText) this.findViewById(R.id.reg_et_reUserPass_phone);
		et_qq = (EditText) this.findViewById(R.id.reg_et_qqnumber_phone);
		reg_tip = (TextView) findViewById(R.id.reg_tip_phone);

		reg_phone_num_text_username = (TextView) findViewById(R.id.reg_phone_num_text_username);
		reg_tip.setText(Html.fromHtml("注册即表示同意" + "<font color='#1a65cb'>《"
//				+ getResources().getString(R.string.app_logo)
				+ "cp软件用户注册协议》</font>"));
		// 显示下划线
		reg_phone_num_text_username.getPaint().setFlags(
				Paint.UNDERLINE_TEXT_FLAG);
		check_phone_ma_button_phone = (Button) findViewById(R.id.check_phone_ma_button_phone);
		check_phone_ma_edit_phone = (EditText) findViewById(R.id.check_phone_ma_edit_phone);

		verificationCodeUtils = new VerificationCodeUtils(this,
				new VerificationCodeUtils.VerificationCodeListener() {
					@Override
					public void onCheckProgress(int status, int progress) {
						if (status == VerificationCodeUtils.FINISHED
								&& progress == -1) {
							check_phone_ma_button_phone.setText("重新获取验证码");
						} else if (status == VerificationCodeUtils.RUNNING) {
							check_phone_ma_button_phone.setText("(" + progress
									+ ")");
						}
					}

					@Override
					public void onCheckComplete(int params, String result,
							String msg) {
						switch (params) {
						case 0: // 请求短信验证码

							break;
						case 1: // 检查短信验证码

							if (LessThan2Min()) {
								MyToast.getToast(context, "请两分钟后再注册").show();
							} else {
								if (result.equals(App.ERROR_SUCCESS + "")) {
									new MyAsynTask().execute();
								} else {
									MyToast.getToast(context, "msg").show();
								}
							}
							break;
						}
					}
				});
	}

	/**
	 * 初始化参数
	 */
	private void init() {
		time = RspBodyBaseBean.getTime();
		imei = RspBodyBaseBean.getIMEI(context);
	}

	/**
	 * 绑定监听
	 */
	private void setListener() {
		btn_back.setOnClickListener(this);
		btn_login.setOnClickListener(this);
		btn_reg.setOnClickListener(this);
		et_name.setOnClickListener(this);
		et_name_phone.setOnFocusChangeListener(new MyEditTextFocusChangeListener());
		// et_pass.setOnFocusChangeListener(new
		// MyEditTextFocusChangeListener());
		et_pass.addTextChangedListener(new EditChangedListener());
		et_upass.setOnFocusChangeListener(new MyEditTextFocusChangeListener());
		reg_tip.setOnClickListener(this);
		check_phone_ma_button_phone.setOnClickListener(this);
		reg_phone_num_text_username.setOnClickListener(this);
	}

	/**
	 * 检验是否密码强度过弱
	 */
	public boolean ruoCheck(String password) {
		if (password.equals("123456") || password.equals("654321")
				|| password.equals("123456789") || password.equals("987654321")
				|| password.equals("12345678") || password.equals("87654321")
				|| password.equals("1234567") || password.equals("7654321"))
			return false;
		else
			return true;
	}

	/**
	 * 是否包含特殊字符
	 * 
	 * @param password
	 * @return
	 */
	public boolean checkSpecial(String password) {
		String all = "(\\~|\\!|\\@|\\#|\\$|\\%|\\^|\\&|\\*|\\(|\\)|\\_|\\-|\\=|\\+|\\\\|\\||\\[|\\]|\\{|\\}|\\;|\\'|\\:|\\\"|\\,|\\.|\\/|\\<|\\>|\\?)";
		Pattern pattern = Pattern.compile(all, Pattern.CASE_INSENSITIVE);
		boolean isSpecial = pattern.matcher(password).find();
		return isSpecial;
	}

	/**
	 * 去除重复字符方法
	 */
	public List quchong(String password) {
		List list = new ArrayList();
		for (int i = 0; i < password.length(); i++) {
			if (!list.contains(password.substring(i, i + 1))) {
				list.add(password.substring(i, i + 1));
			}
		}
		return list;
	}

	/**
	 * 监听密码文本输入
	 */
	class EditChangedListener implements TextWatcher {
		@Override
		public void afterTextChanged(Editable et) {
		}

		@Override
		public void beforeTextChanged(CharSequence s, int start, int count,
				int after) {
		}

		@Override
		public void onTextChanged(CharSequence et, int start, int count,
				int after) {
			tv_passAlert.setVisibility(View.GONE);
			// 输入文字中的状态，count是一次性输入字符数
			String str = et.toString();
			if (str.length() < 6 || str.length() > 16) {
				tv_passAlert.setVisibility(View.VISIBLE);
				tv_passAlert.setText("请输入6-16位数字、字母或常用符号，字母区分大小写");
			}
			if (quchong(str).size() < 3 || !ruoCheck(str)) {
				tv_passAlert.setVisibility(View.VISIBLE);
				tv_passAlert.setText("您输入的密码强度过弱，请重新输入，试试字母、数字、常用符号的组合");
			}
			if (null == str || "".equals(str)) {
				tv_passSecurityLevel.setVisibility(View.VISIBLE);
				changeTextView(tv_weaK);
				// 弱密码
			} else if (str.length() < 6 || quchong(str).size() < 3
					|| !ruoCheck(str)) {
				tv_passSecurityLevel.setVisibility(View.VISIBLE);
				changeTextView(tv_weaK);
				// 强密码
			} else if (str.length() > 5 && quchong(str).size() > 2
					&& checkSpecial(str) && checkContainsLetter(str)
					&& checkContainsNum(str)) {
				tv_passSecurityLevel.setVisibility(View.VISIBLE);
				changeTextView(tv_strong);
				// 中密码
			} else {
				tv_passSecurityLevel.setVisibility(View.VISIBLE);
				changeTextView(tv_middle);
			}
		}
	}

	/**
	 * 是否包含数字
	 * 
	 * @param password
	 * @return
	 */
	public boolean checkContainsNum(String password) {
		String all = "[0-9]";
		Pattern pattern = Pattern.compile(all, Pattern.CASE_INSENSITIVE);
		boolean isSpecial = pattern.matcher(password).find();
		return isSpecial;
	}

	/**
	 * 是否包含字母
	 * 
	 * @param password
	 * @return
	 */
	public boolean checkContainsLetter(String password) {
		String all = "[a-zA-Z]";
		Pattern pattern = Pattern.compile(all, Pattern.CASE_INSENSITIVE);
		boolean isSpecial = pattern.matcher(password).find();
		return isSpecial;
	}

	/**
	 * 改变强度
	 * 
	 * @param tv
	 */
	public void changeTextView(TextView tv) {
		tv_weaK.setBackgroundResource(R.drawable.follow_btn_bg);
		tv_middle.setBackgroundResource(R.drawable.follow_btn_bg);
		tv_strong.setBackgroundResource(R.drawable.follow_btn_bg);
		tv_weaK.setTextColor(Color.BLACK);
		tv_middle.setTextColor(Color.BLACK);
		tv_strong.setTextColor(Color.BLACK);

		tv.setBackgroundResource(R.drawable.bet_btn_dan_selected);
		tv.setTextColor(Color.WHITE);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.reg_top_btn_login_phone:
			doLogin();
			break;
		case R.id.reg_btn_reg_phone:
			userName = et_name.getText().toString().trim();
			userNamePhone = et_name_phone.getText().toString().trim();
			userPass = et_pass.getText().toString().trim();
			userRePass = check_phone_ma_edit_phone.getText().toString().trim();
			userQQ = et_qq.getText().toString().trim();

			if (NetWork.isConnect(context) && checkEdit(et_name, false) && checkEdit(et_name_phone, false)
					&& checkEdit(et_pass, false)
					&& checkEdit(check_phone_ma_edit_phone, false)) {
				new MyAsynTask_check().execute(1);
			} else {
				if (!checkEdit(et_name, false)) {
					et_name.requestFocus();
					return;
				}
				if (!checkEdit(et_name_phone, false)) {
					et_name_phone.requestFocus();
					return;
				}
				if (!checkEdit(et_pass, false)) {
					et_pass.requestFocus();
					return;
				}
				if (!checkEdit(check_phone_ma_edit_phone, false)) {
					check_phone_ma_edit_phone.requestFocus();
					return;
				}
			}
			break;
		case R.id.btn_back:
//			Intent intent = new Intent(context, LoginActivity.class);
//			this.startActivity(intent);
			this.finish();
			break;
		case R.id.reg_tip_phone:
			Intent intent2 = new Intent(context, Regist_Agreement.class);
			startActivity(intent2);
			break;
		case R.id.reg_phone_num_text_username:
			Intent intent1 = new Intent(context, RegisterNewActivity.class);
			startActivity(intent1);
			finish();
			break;
		case R.id.check_phone_ma_button_phone:
			userNamePhone = et_name_phone.getText().toString().trim();
			if (checkEdit(et_name_phone, false))
				new MyAsynTask_check().execute(0);
			break;
		}
	}

	/**
	 * 跳到登录页面
	 */
	private void doLogin() {
//		Intent intent = new Intent(context, LoginActivity.class);
//		this.startActivity(intent);
		this.finish();
	}

	/**
	 * 当文本改变时 *
	 */
	class MyEditTextFocusChangeListener implements View.OnFocusChangeListener {
		@Override
		public void onFocusChange(View v, boolean hasFocus) {
			checkEdit(v, hasFocus);
		}
	}

	/**
	 * 检查输入情况
	 * 
	 * @param v
	 *            指定的控件
	 * @param hasFocus
	 *            true获得焦点，false失去焦点
	 */
	private boolean checkEdit(View v, boolean hasFocus) {
		switch (v.getId()) {

		case R.id.reg_et_userName:
			if(!hasFocus){
				/**
				 * 判断是否含非法字符
				 */
				String all = "^[\\u4e00-\\u9fa5\\w]+$";// 匹配中文、数字、字母
				String username = et_name.getText().toString().trim();
				if ("".equals(username)) {
//					MyToast.getToast(context, "用户名不能为空").show();
					((EditText) v).setError("用户名不能为空");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
					return false;
				}
				Pattern pattern = Pattern.compile(all);
				boolean isPassUserName = pattern.matcher(username).matches();
				if (!isPassUserName) {
//					MyToast.getToast(context, "用户名只能为数字、英文、中文").show();
					((EditText) v).setError("用户名只能为数字、英文、中文");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
					return false;
				}

				int charLength = LotteryUtils.getRexStrLength(username);
				if (charLength < 6 || charLength > 16) {
//					MyToast.getToast(context, "用户名长度为6-16个字符").show();
					((EditText) v).setError("用户名长度为6-16个字符");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
					return false;
				}
				((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
						0, 0, 0);
				return true;
			}
			break;
		case R.id.reg_et_userName_phone:
			if (!hasFocus) {

				String str = ((EditText) v).getText().toString();
				if (null == str || str.equals("")) {
					// ((EditText) v).requestFocus();
					((EditText) v).setError("手机号不能为空");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else if (!LotteryUtils.checkPhoneREX(str)) {
					((EditText) v).setError("手机号码不符合规则");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else {
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, 0, 0);
					return true;
				}
			}
			break;
		case R.id.reg_et_userPass_phone:
			if (!hasFocus) {
				String str = ((EditText) v).getText().toString();
				if (null == str || str.equals("")) {
					((EditText) v).setError("密码不能为空");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else if (str.length() < 6) {
					((EditText) v).setError("密码至少6位");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else if (str.length() > 16) {
					((EditText) v).setError("密码最多16位");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else {
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, 0, 0);
					return true;
				}
			}
			break;
		case R.id.check_phone_ma_edit_phone:
			if (!hasFocus) {
				String str = ((EditText) v).getText().toString();
				if (null == str || str.equals("")) {
					((EditText) v).setError("验证码不能为空");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else {
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, 0, 0);
					return true;
				}
			}
			break;
		case R.id.reg_et_qqnumber_phone:
			if (!hasFocus) {
				String qqNumber = ((EditText) v).getText().toString();
				if (null == qqNumber || qqNumber.equals("")) {
					((EditText) v).setError("请输入qq号");
					((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
							0, R.drawable.ic_action_error, 0);
				} else {
					byte[] bytes = qqNumber.getBytes();
					if (bytes.length < 6) {
						((EditText) v).setError("qq号最少为6位");
						((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
								0, R.drawable.ic_action_error, 0);
						//MyToast.getToast(context, "qq号最少为6位").show();
						return false;
					}else {
						((EditText) v).setCompoundDrawablesWithIntrinsicBounds(0,
								0, 0, 0);
						return true;
					}
					
				}
			}
			
			
			break;
		}
		return false;
	}

	/**
	 * 异步任务 用来后台获取数据
	 */
	class MyAsynTask extends AsyncTask<Void, Integer, String> {
		String error = "-1";
		//足彩沐沐47
		//西西43
		//lau12138 52
		//mmm球 51
		//我来了绝恋 4
		@Override
		protected String doInBackground(Void... params) {
			opt = "1";
			String key = MD5.md5(App.MD5_key);
			info = RspBodyBaseBean.changeRegister_info("1", userName,
					MD5.md5(userPass + App.MD5_key) ,userNamePhone, userQQ);
			crc = RspBodyBaseBean.getCrc(time, imei, key, info, "-1");
			auth = RspBodyBaseBean.getAuth(crc, time, imei, "-1");

			String values[] = { opt, auth, info };
			String result = HttpUtils.doPost(App.names, values,
					App.path);

			Log.i("x", "注册info---------" + info);
			Log.i("x", "注册时的result----" + result);

			if ("-500".equals(result))
				return result;

			try {
				JSONObject ob = new JSONObject(result);
				error = ob.getString("error");
				if ("0".equals(error)) {
					App.user = new Users();
					App.user.setUid(ob.optString("uid"));
					App.user.setName(ob.optString("name"));
					App.user.setRealityName(ob.optString("realityName"));
					App.user.setBalance(ob.optLong("balance"));
					App.user.setFreeze(ob.optDouble("freeze"));
					App.user.setEmail(ob.optString("email"));
					App.user.setIdcardnumber(ob.optString("idcardnumber"));
					App.user.setMobile(ob.optString("mobile"));
					App.user.setMsgCount(ob.optInt("msgCount"));
					App.user.setMsgCountAll(ob.optInt("msgCountAll"));
					App.user.setScoring(ob.optInt("scoring"));
					// 用户密码 （没加密的）
					App.user.setUserPass(userPass);
					return App.ERROR_SUCCESS + "";
				}
			} catch (Exception e) {
				e.printStackTrace();
				error = "-1";
			}
			return error;
		}

		/**
		 * 最开始执行的
		 */
		@Override
		protected void onPreExecute() {
			mProgress = BaseHelper.showProgress(context, null, "注册中....", true,
					true);
			super.onPreExecute();
		}

		@Override
		protected void onPostExecute(String result) {
			mProgress.dismiss();
			Log.i("x", "发送消息。。。。。");
			myHandler.sendEmptyMessage(Integer.parseInt(result));
			super.onPostExecute(result);
		}
	}

	/**
	 * 重写返回键事件
	 */
//	@Override
//	public boolean onKeyDown(int keyCode, KeyEvent event) {
//		if (keyCode == KeyEvent.KEYCODE_BACK) {
//			Intent intent = new Intent(context, LoginActivity.class);
//			this.startActivity(intent);
//			this.finish();
//		}
//		return super.onKeyDown(keyCode, event);
//	}

	/**
	 * 处理页面显示的
	 */
	@SuppressLint("HandlerLeak")
	class MyHandler extends Handler {
		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case 0:
				MyToast.getToast(context, "注册成功").show();
				App.Status = "1";
				MyPushTask.newInstances(context).commit();
				Intent intent = new Intent(Regist_phoneNum_new_Activity.this, MainActivity.class);
				startActivity(intent);

				// 将用户名记住
				SharedPreferences mSettings = getSharedPreferences("app_user",
						0);
				SharedPreferences.Editor editor = mSettings.edit();
				editor.putString("name", userName);
				editor.putString("pass", userPass);
				editor.putBoolean("isLogin", true);
				editor.commit();
				break;
			case 1:
				MyToast.getToast(context, "网络不稳定，请稍后再试").show();
				break;
			case -2:
				MyToast.getToast(context, "两次密码不正确，请重新输入").show();
				break;
			case -10:
				MyToast.getToast(context, "密码长度必须大于等于6").show();
				break;
			case -11:
				MyToast.getToast(context, "手机号码不能为空").show();
				break;
			case -12:
				MyToast.getToast(context, "手机号码不符合规则").show();
				break;
			case -13:
				MyToast.getToast(context, "验证码不能为空").show();
				break;
			case -500:
				MyToast.getToast(context, "连接超时").show();
				break;
			case -110:
				MyToast.getToast(context, "该手机号码已存在。注册失败").show();
				break;
			default:
				MyToast.getToast(context, "注册失败").show();
				Log.i("x", "-----注册错误-----:" + msg.what);
				break;
			}
			super.handleMessage(msg);
		}
	}

	/**
	 * 2分钟不重复提交注册
	 * 
	 * @return
	 */
	private boolean LessThan2Min() {
		long now = System.currentTimeMillis();
		if (now - lastRegistTime < 2 * 60 * 1000) {
			return true;
		}
		lastRegistTime = now;
		return false;
	}

	// 判断是否绑定了手机号码
	class MyAsynTask_check extends AsyncTask<Integer, Integer, String> {
		private int param;

		@Override
		protected String doInBackground(Integer... params) {
			param = params[0];
			String error = "-1";
			opt = "59";
			time = RspBodyBaseBean.getTime();
			imei = RspBodyBaseBean.getIMEI(context);
			String key = MD5.md5(App.MD5_key);
			info = "{\"mobile\":\"" + et_name_phone.getText().toString().trim()
					+ "\"}";
			crc = RspBodyBaseBean.getCrc(time, imei, key, info, "-1");
			auth = RspBodyBaseBean.getAuth(crc, time, imei, "-1");

			String values[] = { opt, auth, info };
			String result = HttpUtils.doPost(App.names, values,
					App.path);

			Log.i("x", "验证手机号info---------" + info);
			Log.i("x", "验证手机号result----" + result);

			if ("-500".equals(result))
				return result;
			try {
				JSONObject ob = new JSONObject(result);
				String hasPhoneNumber = ob.getString("hasPhoneNumber");
				if ("0".equals(hasPhoneNumber)) {
					return App.ERROR_SUCCESS + "";
				}
			} catch (JSONException e) {
				Log.w("TAG", "JSONException==>" + e.toString());
				error = "-1";
			}
			return error;

		}

		@Override
		protected void onPostExecute(String s) {
			super.onPostExecute(s);
			switch (Integer.valueOf(s)) {
			case 0:
				if (param == 0) {
					verificationCodeUtils.startCheck(0, userNamePhone);
				} else if (param == 1) {
					verificationCodeUtils.startCheck(1, userNamePhone, userRePass);
				}
				break;
			case -1:
				et_name_phone.setError("该手机号码已注册");
				et_name_phone.setCompoundDrawablesWithIntrinsicBounds(0, 0,
						R.drawable.ic_action_error, 0);
				break;
			case -500:
				MyToast.getToast(context, "网络超时").show();
				break;
			default:
				Log.i("---", s);
				break;
			}
		}
	}
}
